package demo;

public class Test {
    public static void func(Animal animal){
        animal.eat();
    }
    public static void main(String[] args) {
       Animal animal=new Bird();
       Bird bird=(Bird) animal;
       bird.fly();
        System.out.println("======================");
        Animal animal2=new Dog();
        //animal2是否引用了Bird这个对象
        if(animal2 instanceof Bird){
            Bird bird2=(Bird) animal2;
            bird2.fly();
        }else {
            System.out.println("animal2 instanceof Bird not!!!");
        }

    }
}
